package org.jeecg.modules.yusuan.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.system.entity.SysDepart;
import org.jeecg.modules.yusuan.entity.CaiwuYusuan;
import org.jeecg.modules.yusuan.entity.CaiwuZhijie;
import org.jeecg.modules.yusuan.entity.NianDuHuiZong;

import java.util.List;
import java.util.Map;

/**
 * @Description: caiwu_yusuan
 * @Author: jeecg-boot
 * @Date:   2020-06-15
 * @Version: V1.0
 */
public interface CaiwuZhijieMapper extends BaseMapper<CaiwuZhijie> {

    void deleteNotExist(@Param("zhijieList") List<CaiwuZhijie> zhijieList);

    List<NianDuHuiZong> yusuanhuizong(@Param("deptList") List<SysDepart> departList);
    List<NianDuHuiZong> zhibiaohuizong(@Param("deptList") List<SysDepart> departList);

    List<CaiwuZhijie> listData(@Param("deptId") String deptId,@Param("deptCode") String deptCode, @Param("categoryPid") String categoryPid);

    @Select("select hjshenheshu as shenheshu,category_id as categoryId from caiwu_zhijie y,sys_category c where c.id = y.category_id and c.sys_org_code = 'A01' and dept_id = #{deptId}")
    List<Map> shenheshu(@Param("deptId") String deptId);

    @Select("select yuskm,sum(zhuanzje) baoxiaoshu from (select d.* from hq_baoxiao_detail d,hq_baoxiao b where b.id = d.baoxiao_id and b.sys_org_code = #{deptCode}) a group by yuskm")
    List<Map> hejbaoxiao(@Param("deptCode") String deptCode);
}
